Chart A
violin_ggplot =
instacart %>%
mutate(department = forcats::fct_reorder(department, order_hour_of_day, fun = IQR)) %>%
ggplot(aes(x = department, y = order_hour_of_day)) +
geom_violin(aes(fill = department), color = "blue", alpha = .5) +
stat_summary(fun.y = median, geom = "point", color = "blue", size = 2) +
guides(fill = "none") +
labs(
title = "Order Hour of Day Plot",
x = "Department",
y = "Order Hour of Day",
caption = "Data from Instacart"
) +
theme_bw() +
coord_flip()
ggplotly(violin_ggplot)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`